package com.rzjm.api.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.rzjm.api.dao.PickUpPlanDao;
import com.rzjm.api.entity.PickUpPlan;
import com.rzjm.api.service.PickUpPlanService;
import com.rzjm.api.util.DateUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class PickUpPlanServiceImpl extends BaseServiceImpl<PickUpPlanDao, PickUpPlan> implements PickUpPlanService {

    @Resource
    private PickUpPlanDao planDao;

    @Override
    public PickUpPlan getTodayPlan(int shop_id) {
        QueryWrapper<PickUpPlan> qw = new QueryWrapper<>();
        qw.eq("shop_id",shop_id);
        qw.eq("state",2);
//        qw.eq("plan_date", DateUtil.getDay());
        qw.last("limit 1");
        qw.orderByDesc("id");
        return planDao.selectOne(qw);
    }
}
